package com.yuwei.module_vehicles.adapter

import android.annotation.SuppressLint
import com.bw.lib_http.entity.CarPaymentsEntityItem
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.module_vehicles.R
import java.text.SimpleDateFormat
import java.util.*

class CarPaymentsAdapter:BaseQuickAdapter<CarPaymentsEntityItem,BaseViewHolder>(R.layout.car_item) {
    @SuppressLint("SimpleDateFormat")
    override fun convert(holder: BaseViewHolder, item: CarPaymentsEntityItem) {
        holder.setText(R.id.vehicle_carId,item.plateNumber)
        holder.setText(R.id.vehicle_username_type,"张先生 | 特斯拉")
        holder.setText(R.id.vehicle_in_time_tv,"入场:${item.entryTime}")
        holder.setText(R.id.vehicle_location_time_tv,item.parkingSpaceNumber)
        val simpleDateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
        val format = simpleDateFormat.parse(item.entryTime).time
        val format2 = simpleDateFormat.parse(item.exitTime).time
        val l = format2 - format
        val simpleDateFormat1 = SimpleDateFormat("HH小时mm分钟")
        val fromat1 = simpleDateFormat1.format(l)
        holder.setText(R.id.vehicle_park_time_tv,"已停:${fromat1}")
    }
}